
#ifndef __XB_PORTABLE_H__
#define __XB_PORTABLE_H__

/* ------------------------------------------------------------------------- */

#if _MSC_VER >= 1400
#define _CRT_SECURE_NO_WARNINGS
#endif
#if _MSC_VER >= 1500
#define _SCL_SECURE_NO_WARNINGS
#endif

/* fastcall */
#if defined(__GNUC__)
#define fastcall				__attribute__ ((regparm(3)))
#elif defined(_MSC_VER)
#define fastcall				__fastcall
#else
#define fastcall
#endif

/* extern "C" */
#ifndef __cplusplus
#define capi
#else
#define capi					extern "C"
#endif

/* inline */
#if defined(_MSC_VER)
#define inline					__forceinline
#elif !defined(__cplusplus)
#if defined(__GNUC__)
#define inline					__inline__
#else
#define inline
#endif
#endif

/* bool */
#if !defined(__cplusplus)
#if __STDC_VERSION__ >= 199901L
#include <stdbool.h>
#else
typedef enum { false, true }	bool;
#endif
#endif

/* unsigned integer */
typedef unsigned int			uint;

/* fix-sized integer */
#if __STDC_VERSION__ >= 199901L
#include <stdint.h>
typedef int8_t					int8;
typedef int16_t					int16;
typedef int32_t					int32;
typedef int64_t					int64;
typedef uint8_t					uint8;
typedef uint16_t				uint16;
typedef uint32_t				uint32;
typedef uint64_t				uint64;
#elif defined(_MSC_VER)
typedef signed __int8			int8;
typedef signed __int16			int16;
typedef signed __int32			int32;
typedef signed __int64			int64;
typedef unsigned __int8			uint8;
typedef unsigned __int16		uint16;
typedef unsigned __int32		uint32;
typedef unsigned __int64		uint64;
#else
typedef signed char				int8;
typedef signed short			int16;
typedef signed int				int32;
typedef signed long long		int64;
typedef unsigned char			uint8;
typedef unsigned short			uint16;
typedef unsigned int			uint32;
typedef unsigned long long		uint64;
#endif

/* float */
typedef float					float32;
typedef double					float64;
typedef long double				float80;

/* ------------------------------------------------------------------------- */

#endif
